<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include_once "database.php";
include_once "RateInfoProperties.php";

$conn = mysql_connect($host, $userName, $password);

if (!$conn) {
    echo "Unable to connect to DB: " . mysql_error();
    exit;
}
  
if (!mysql_select_db($database)) {
    echo "Unable to select mydbname: " . mysql_error();
    exit;
}

$rateInfoProperties = new RateInfoProperties();
$rateInfoProperties->load();
$arrData = $rateInfoProperties->getPropertyArray();


foreach ($arrData as $key => $value)
{
    $sql = "Insert into rateinfor(`Key`, `Value`) Values ('$key','$value')";
    $result = mysql_query($sql);
    
    if (!$result) {
        echo "Could not successfully run query ($sql) from DB: " . mysql_error();
        exit;
    }
}
echo "Import to database Successfully!";
exit();
?>
